public class Test2 {
    public static void main(String[] args) {
        B b1 = new C();
        b1.fun2();
    }
}
class B{
    public void fun2() {
        System.out.println("123");
    }
}
class C extends B {
    @Override
    public void fun2() {
        System.out.println("456");
    }
}

class D extends C {
    public void fun2() {
        System.out.println("789");
    }
}